<!-- daima2131 -->
<template>
	<view class="container">
		<uni-list v-for="(item,index) in list" :key="index">
			<uni-badge :text="item.id">
				<uni-list-item 
				:thumb="'/static'+item.icon" 
				thumbSize="lg" 
				:title="item.name" 
				:note="item.department"
				:clickable="true"
				@click="toDetail(item.id)">
        
				</uni-list-item>
			</uni-badge>
		</uni-list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				"list": []
			}
		},
		methods: {
			toDetail(id){
				console.log(id);
				uni.navigateTo({
					url: '/pages/schooldetail/schooldetail?id='+id,
					
				});
			}
		},
		onLoad() {
			uni.showLoading({
				title: '加载中',
				mask: false
			});
			uni.request({
				url: 'http://localhost:8090/freshmenapp/user/list',
				method: 'POST',
				data: {},
				success: res => {
					console.log(res);
					this.list = res.data.list
					uni.showToast({
						title: '成功'
					});
					setTimeout(() => {
						uni.hideLoading()
					}, 2000)
				},
				fail: () => {
					uni.showToast({
						title: '网络错误',
						icon: 'none'
					});
				},
				complete: () => {}
			});
		}
	}
</script>

<style>
	/deep/.uni-badge {
		position: absolute;
		bottom: 10px;
		right: 5px;
	}
</style>